package ro.peoplecentric.ctc.common.service;

import java.util.List;

import ro.peoplecentric.ctc.common.entity.Category;
import ro.peoplecentric.ctc.common.exception.ApplicationException;

/**
 * Service for Category CRUD.
 * 
 * @author pguzun
 */
public interface CategoryService {

	/**
	 * Saves the {@link Category} to DB. If the provided {@link Category} object
	 * was already associated with the persistent context, the entity's state
	 * will be updated.
	 * 
	 * @param category
	 *            the {@link Category} to save
	 * @throws ApplicationException
	 *             in case of DAO exception
	 */
	void saveCategory(Category category) throws ApplicationException;

	/**
	 * Deletes an existing {@link Category} from the data store.
	 * 
	 * @param category
	 *            the <strong>persistent</strong> {@link Category} to delete
	 * @throws ApplicationException
	 *             in case of DAO exception
	 */
	void deleteCategory(Category currentObject) throws ApplicationException;

	/**
	 * Gets all the {@link Category}s from DB.
	 * 
	 * @return a list of {@link Category}s
	 * @throws ApplicationException
	 *             in case of DAO exception
	 */
	List<Category> getAll() throws ApplicationException;

	/**
	 * Get {@link Category} by id.
	 * 
	 * @param id
	 *            the category ID
	 * @return the found {@link Category} entity or null if not found.
	 */
	Category getById(Long id) throws ApplicationException;
}
